﻿using FlowServe.Models;
using FlowServe.RemotingServer;
using Microsoft.AspNetCore.Mvc;

namespace FlowServe.Controllers
{
    [Route("[controller]/[action]")]
    [ApiController]
    public class TaskBackGround : Controller
    {
        private readonly IRemoting iremoting;

        public TaskBackGround(IRemoting iremoting)
        {
            this.iremoting = iremoting;
        }
        [HttpGet]
        public IActionResult Index()
        {
            return View("Views/Home/Index.cshtml"); // 返回 Views/Home/Index.cshtml
        }

        [HttpPost]
        public string Addwork(WorkTask workTask)
        {
            if (iremoting.AddWork(workTask))
            {
                return "添加成功";
            }
            else
            {
                return "添加失败";
            }
        }
        [HttpPost]
        public string tiggerAction(WorkTask workTask)
        {
            return "111111";
        }
        [HttpPost]
        public string update(WorkTask workTask)
        {
            return "111111";
        }
        [HttpPost]
        public string refresh(WorkTask workTask)
        {
            return "111111";
        }
    }
}
